/*=============================================================
* 	Copyright (C) 2024 USTC All rights reserved.
* 	
* 	filename : noc.h
* 	Author: Wei Jinsong
* 	Mail: vitus@mainl.ustc.edu.cn
* 	Date 2024-05-13
* 	Abstract 
* 		
*
=============================================================*/

#ifndef __NOC_H__
#define __NOC_H__

#include <iostream>
#include <string>
#include <vector>

#include "systemc.h"
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"

#include "common.h"

using namespace std;

class BaseNoC 
    : public::sc_module
    , virtual public SpikeInterface<>
{
public :
    SC_HAS_PROCESS(BaseNoC);
    BaseNoC(sc_module_name name, uint32_t port_num, sc_clock &clk);
    ~BaseNoC();

    sc_in_clk clk;
    sc_port<SpikeInterface<>> **txSpikePorts;
    SpikeFifo<SpikePayload*> **rxSpikeFifo;
    vector<vector<SpikePayload*>> txSpikePipebuff;
    // const int pipe_spike_delay;

public :
    const uint32_t mExternalPortNum;

    void exec();
    bool spike_transport_fw(SpikePayload& trans, sc_core::sc_time &delay);
};

// class BaseNoC
//     : public::sc_module
//     , virtual public tlm::tlm_bw_transport_if<>
//     , virtual public tlm::tlm_fw_transport_if<>
// {
// public :
//     SC_HAS_PROCESS(BaseNoC);
//     BaseNoC(sc_module_name name, uint32_t port_num);
//     ~BaseNoC();
//
//     tlm::tlm_initiator_socket<> *initiatroSockets;
//     tlm::tlm_target_socket<>    *targetSockets;
//
// public :
//     const uint32_t mExternalPortNum;
//
// };

#endif

